UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qHPJNsmgC0Pn74LKkUMuyQlIAVARE8AFQQBLz965XbU=' 
WHERE 
  key_id = '6688f54795c44ff54bad0cb6f14e2488d861a039e79221ba0f702c6c92f51e55' 
  AND (
    token = 'qHPJNsmgC0Pn74LKkUMuyQlIAVARE8AFQQBLz965XbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061