UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vvEGTDu7/HbWC9rH0DlK8sDcwlkKHYc3+UySN/x2vVU=' 
WHERE 
  key_id = 'be8632915ec71fee4d28903a3fdacaa58f147f30806fdf9510c9e3378f0fe03e' 
  AND (
    token = 'vvEGTDu7/HbWC9rH0DlK8sDcwlkKHYc3+UySN/x2vVU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040