UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g84dCg1qggFfnPOFthQzk67jXSSTIVPd7I1o9el3I/M='
WHERE
key_id = 'e3480f47239cc814ee622ccafb091e1c8d46e0214b7c899755ac7237df22e2f3'
AND (
token = 'g84dCg1qggFfnPOFthQzk67jXSSTIVPd7I1o9el3I/M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)