UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rS4L9gEMGgJfD5+jt97pv6ZMrD0eTA/pvdjBOFyfTl4='
WHERE
key_id = 'ba1996da9e2a004efea25665266e26e5fdae6101c7bc2e6bb629191c13449095'
AND (
token = 'rS4L9gEMGgJfD5+jt97pv6ZMrD0eTA/pvdjBOFyfTl4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)