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