UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J/e+OBpQYnmc8hLp18ihh/fRZJpSfae+ckdj6X0v2OI=' 
WHERE 
  key_id = 'f45e63482f8e8763c28033b8f0807215919d9dbde2aee7fa77b6f115542d35ae' 
  AND (
    token = 'J/e+OBpQYnmc8hLp18ihh/fRZJpSfae+ckdj6X0v2OI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034