UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0d4egfDr3E/+3czMe6JWFUJnVbB6WYm5EVQ/I51iVTU='
WHERE
key_id = 'c065448f8c012086ddcb4a3de2e04315a86b6376e9b6ccffba76928f587ce602'
AND (
token = '0d4egfDr3E/+3czMe6JWFUJnVbB6WYm5EVQ/I51iVTU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)