UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D4SKAQJCj65Mawv6nDV0lktKx7c+WxspBMKOECKsoMM=' 
WHERE 
  key_id = 'fbdd31f92f774ec01b6eadfc97c8b9a04ad84d424fe8c2429e1e6cf18ccd6a4d' 
  AND (
    token = 'D4SKAQJCj65Mawv6nDV0lktKx7c+WxspBMKOECKsoMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048