UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kf/6Z0wKCFqNDGICYlFhomNrTIhH3zZzfNE0sJgp5iI=' 
WHERE 
  key_id = '71313122d96933afb1ccc369933ebde383f7cdc0662ad55106f8227621aff544' 
  AND (
    token = 'Kf/6Z0wKCFqNDGICYlFhomNrTIhH3zZzfNE0sJgp5iI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047