UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'epy+7C70Jpw17QrfDSauFRMDjq1GmdzYEBnC+tb/KsQ=' 
WHERE 
  key_id = 'c059f6579619df34a3c15c860b66ac89a4877dfdd50ac6a8f2b35617e742bb35' 
  AND (
    token = 'epy+7C70Jpw17QrfDSauFRMDjq1GmdzYEBnC+tb/KsQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026