UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DE5Eh75pVssr3m/98gLQFCX4J7GqWYRlSYTDDfhuj4k='
WHERE
key_id = 'c7f9eb59fe708122e5a15560d1e0715df561dd4ef940e3cf43a7a79259bb7a4c'
AND (
token = 'DE5Eh75pVssr3m/98gLQFCX4J7GqWYRlSYTDDfhuj4k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)