UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k4BsAVQgfFmyI803dHrTzq5voK85YjATdj8Wf1bDQKU=' 
WHERE 
  key_id = '8aa2ce645652f79086367b36ca070abdfeed6136ebebab046f890069b7891dc3' 
  AND (
    token = 'k4BsAVQgfFmyI803dHrTzq5voK85YjATdj8Wf1bDQKU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024