UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'orLGrEylWqRX2viMWLtauSCJINTBzeK6v9YDjC+n8qY='
WHERE
key_id = 'eff3b774808c871dfa8252a6b6981b5b399e214b7ce35f5f5658f82c6ad33b4f'
AND (
token = 'orLGrEylWqRX2viMWLtauSCJINTBzeK6v9YDjC+n8qY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)