UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W2kGuzEIOJCkNn68l3h0VH9n+0h4pM6ULMcYPB/9arU=' 
WHERE 
  key_id = 'c52a6527d02f63a442c543460f03b83515cd1813cb852c0c2417f15bc89100d2' 
  AND (
    token = 'W2kGuzEIOJCkNn68l3h0VH9n+0h4pM6ULMcYPB/9arU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039