UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LQSzt15QF1Srn0ZPSD+pzelvfIFX42hC9o0GJ+K9174='
WHERE
key_id = '1964c78b28400eac7b70e2418ac80e0b537d43159865f43ebcd71e3191fa8fde'
AND (
token = 'LQSzt15QF1Srn0ZPSD+pzelvfIFX42hC9o0GJ+K9174='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)