UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HJfAArpdvr3GAi5KsaRXXYbiZcBWGUAuCt7OfITJi+g='
WHERE
key_id = 'a457bd833e6a901ce2175650b67d8db60446e02179d4f30ef885bbb275ff7226'
AND (
token = 'HJfAArpdvr3GAi5KsaRXXYbiZcBWGUAuCt7OfITJi+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)