UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ha+4BXyT11IIqtnPM4RKy1C+7650tqcVdt5fNfsZGaI=' 
WHERE 
  key_id = '98b85848e29227018e954b600b72c94722cc989c6c0a2980d28f3109d5811450' 
  AND (
    token = 'Ha+4BXyT11IIqtnPM4RKy1C+7650tqcVdt5fNfsZGaI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037