UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mVhliqnEM34+3ylGqfJbYfyIj3nbiQTLJi6SCgvL5p4='
WHERE
key_id = 'e46813363bc030e3e424190f24b7312f8937c4752a8fc4c3eba18afcfa86fefd'
AND (
token = 'mVhliqnEM34+3ylGqfJbYfyIj3nbiQTLJi6SCgvL5p4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)