UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iK9Y+rmebFVjrhxFtDVZWODUPoWttTW4QWessc3wOic=' 
WHERE 
  key_id = 'a3544a754d82d8be340d54ef201ad8ad6fefa948a6966592a253b53c31055ab9' 
  AND (
    token = 'iK9Y+rmebFVjrhxFtDVZWODUPoWttTW4QWessc3wOic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045