UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S/GYDWma/h/e3xx8A9VZTC9S9aa+6wV3LPxx8G+KtpI=' 
WHERE 
  key_id = 'a7e67de2513c68e1271b57585d54fba3cfbe56b42b49057be52d9e207e8f5615' 
  AND (
    token = 'S/GYDWma/h/e3xx8A9VZTC9S9aa+6wV3LPxx8G+KtpI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027