UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dDbsy7fiJb4lk1zthjLsSPEeFgTBxxt7AwWeAKbDXLs='
WHERE
key_id = 'd5c23874a501331927511267be9eec04a54eb5213971abf60afe6c88d03a649d'
AND (
token = 'dDbsy7fiJb4lk1zthjLsSPEeFgTBxxt7AwWeAKbDXLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)