UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r8Drv8sS5KGPwjOrirv8a+ylMuCFVCwzljw0QBQsDWE=' 
WHERE 
  key_id = '52d42770606cc38ba72d99f8f2be2d242756452e88c4f51d9ce50cc0990ccf3f' 
  AND (
    token = 'r8Drv8sS5KGPwjOrirv8a+ylMuCFVCwzljw0QBQsDWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039