UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'njxaIljjzo6bOMJfvU1dxKyuXIQRF/FO99KU8K3zl1g=' 
WHERE 
  key_id = '5a1699963c5b34c4f96e24a57e38f8a4052d3e589102562267a941cc1d0af170' 
  AND (
    token = 'njxaIljjzo6bOMJfvU1dxKyuXIQRF/FO99KU8K3zl1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032