UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u3VkZfzy3PdwloCnH4+PIXp2elGrUWqEWbPVXSiih4Q=' 
WHERE 
  key_id = '794482b4ca8ffc82b5c4b4c5fe03e38eb0b77c5e070913de8aaf6ce08f9e3fef' 
  AND (
    token = 'u3VkZfzy3PdwloCnH4+PIXp2elGrUWqEWbPVXSiih4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046