UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AgpBM2tb2mBM7InGk0XrJaeKM85yG0otHmRBvQT5Gkw=' 
WHERE 
  key_id = '7ea1f21e28bc922ded8bb2afbe347f30d9556688a628c907ccba6173592e693b' 
  AND (
    token = 'AgpBM2tb2mBM7InGk0XrJaeKM85yG0otHmRBvQT5Gkw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045