UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zvl7DWgUzB5zWTdieFO7mii64yEmkEcX26ZzDprQ1AE=' 
WHERE 
  key_id = '80113baa9e8ad80d305b88882c417790d140a6270e6228939eb6df9cee6c2da5' 
  AND (
    token = 'Zvl7DWgUzB5zWTdieFO7mii64yEmkEcX26ZzDprQ1AE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052