UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J4y1cY3/DC2N167zTYEU5nstYX8whAfT6Hm71Dr5OB0='
WHERE
key_id = 'f30ae592c23c4f202dabcbaf0f5cfc76e568b378eafc793d38a25eacf47b3fda'
AND (
token = 'J4y1cY3/DC2N167zTYEU5nstYX8whAfT6Hm71Dr5OB0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)