UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WkA+UWnn9wnv0NQCjCncoTO3im+5Z95RicMOgwm07jg=' 
WHERE 
  key_id = 'bd0a1f0a7d6575efee31b2333e4d4e45fc5084594ff7ce96ac308b93a643fad4' 
  AND (
    token = 'WkA+UWnn9wnv0NQCjCncoTO3im+5Z95RicMOgwm07jg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020