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

Query time 0.00042