UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'chHKrELAMmwScYluiO9PauToafMzUM3WMzAb1J5hmZY=' 
WHERE 
  key_id = '52d199f0461a7d86810f8a6e876be7b8a0724bc1d7f43353474ec33c7fa1996d' 
  AND (
    token = 'chHKrELAMmwScYluiO9PauToafMzUM3WMzAb1J5hmZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042