UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WDdcvl7gqSbeAAw7d8157e60KlKXC1wb+3QqxFtSsHg=' 
WHERE 
  key_id = '1dfff5277506381a7dc88485ce34c75854c742d4700fd0777c97f15fb0721e7e' 
  AND (
    token = 'WDdcvl7gqSbeAAw7d8157e60KlKXC1wb+3QqxFtSsHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043