UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'guL+U0VtO4gDX6TC3mb+0gtSaNoBetLKgdDiyhMoo30=' 
WHERE 
  key_id = '1f3d316a1625872e06d1db83bbbec8d7d2ccbee16d10420baf32df14ccf49267' 
  AND (
    token = 'guL+U0VtO4gDX6TC3mb+0gtSaNoBetLKgdDiyhMoo30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062