UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p6KA7pnUoAwZRzA/hTczUSDZuokZ0jfqXos34FDahBw=' 
WHERE 
  key_id = 'f475b898f3a1f15bf9172c3a7b2d758db30f5a38ad0af1d42b029117a06704df' 
  AND (
    token = 'p6KA7pnUoAwZRzA/hTczUSDZuokZ0jfqXos34FDahBw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024