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