UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MEPQ9vaz0f0XXc1ZiCErvF/6gxAIatCgSeGr1PdeRtU=' 
WHERE 
  key_id = '3d3b385d30296b4cc822dd1f92f441780258b0646bf20ed389848f363dbd4352' 
  AND (
    token = 'MEPQ9vaz0f0XXc1ZiCErvF/6gxAIatCgSeGr1PdeRtU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022