UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UBn+dfzJ7vncHjZNZS/ehstM9mPgz5yABewKzHatZIg=' 
WHERE 
  key_id = 'a10d1cf9bebcd72497a2a48a654b4406a1deb08ad8f427c56bacbeb56c99a722' 
  AND (
    token = 'UBn+dfzJ7vncHjZNZS/ehstM9mPgz5yABewKzHatZIg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032