UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NKRbCTnnporXzkY32nXpcVdgF7fsWDaPTH5sDWBWsnM=' 
WHERE 
  key_id = '7321bac0f425122c94ba091040a3fa22f1f4e583d018fde89d6c5a9485810852' 
  AND (
    token = 'NKRbCTnnporXzkY32nXpcVdgF7fsWDaPTH5sDWBWsnM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028