UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nRBEpQ5gcfRmqMXUqzH1N5aJYtOlLJ7KpOlJflM4qpQ=' 
WHERE 
  key_id = 'f04c531de5da9b8e51565273f18b055d433533ad0294fd9b4f15a75d72238f32' 
  AND (
    token = 'nRBEpQ5gcfRmqMXUqzH1N5aJYtOlLJ7KpOlJflM4qpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037