UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T7pb1fa3AaCGmP0v3U2KhxnINg0B6Jsm/efaqKbIt+M=' 
WHERE 
  key_id = '1f88e7131b9f95377de689e2ed6199fc0a480c3eec1f6b42e724598e971ab1ab' 
  AND (
    token = 'T7pb1fa3AaCGmP0v3U2KhxnINg0B6Jsm/efaqKbIt+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038