UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NCxprSdJC+wczQ1hGlyeo7HwlPpk8tS5GqzlApilHN4=' 
WHERE 
  key_id = 'c769056897c7b6853167d04524bc99f3f7a939940db5c8d1ad167c0c2083b641' 
  AND (
    token = 'NCxprSdJC+wczQ1hGlyeo7HwlPpk8tS5GqzlApilHN4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015