UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '764Zf13KELpcOwmipLBEBCbKbxT2dezVP5ko85B3gaw='
WHERE
key_id = '659018a9c0abbffa55f5929a6078e4fb89a7c64e74541eef10a901cbc888707b'
AND (
token = '764Zf13KELpcOwmipLBEBCbKbxT2dezVP5ko85B3gaw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)