UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vgkLq2rKYLBEDZpwPLRF4Wn8GKdoo/AFvxKh1SNGaO0=' 
WHERE 
  key_id = '38e0b94766c50881abfb912f25fac5f7e4d6e092f550d2415971e26ac2b6411d' 
  AND (
    token = 'vgkLq2rKYLBEDZpwPLRF4Wn8GKdoo/AFvxKh1SNGaO0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036