UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c969eF2VZ6nEWaeGa1lMbhnEwVtH136+FK/Nwa/gf/M=' 
WHERE 
  key_id = '57d7bacfc85ee4a6bde6582e444d9e0618a87ff986a944088ae04b6f3e64d8ff' 
  AND (
    token = 'c969eF2VZ6nEWaeGa1lMbhnEwVtH136+FK/Nwa/gf/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048