UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qYeyIjwNvSX7zpBq9ptHxNil+9X8jgDvLtTEdAvbDMk=' 
WHERE 
  key_id = '6604478ddf8ef23376a675c0de1d20a1b38b4cdf8f077e1e387389c72544004e' 
  AND (
    token = 'qYeyIjwNvSX7zpBq9ptHxNil+9X8jgDvLtTEdAvbDMk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017