UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1PZC5rjI0PQu+nIt/8xm3lkSGiRndnt3Cg+ertIBW4='
WHERE
key_id = 'f888d98c4ba0b74eba70450ad28cdc07b5e08d40174933ebdbc5e227e3b131ac'
AND (
token = 'B1PZC5rjI0PQu+nIt/8xm3lkSGiRndnt3Cg+ertIBW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)