UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p2Y4vHEZg2F8sJxecsXygEvj5AabiNJWW+gNx6Gk8YI=' 
WHERE 
  key_id = '494056c36c6035d7288966f0c7ecd7336b067463cf2bd503a638e4dab0c7aba5' 
  AND (
    token = 'p2Y4vHEZg2F8sJxecsXygEvj5AabiNJWW+gNx6Gk8YI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042