UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ng0x1IoK8wlG+wPLSQAjhEq9ZPYbvPpO+tun5Po0eTw=' 
WHERE 
  key_id = 'fa4110d0aed5bf156acbc69553bcdab165ffdd7259aaa96fa721eadb00011a0d' 
  AND (
    token = 'ng0x1IoK8wlG+wPLSQAjhEq9ZPYbvPpO+tun5Po0eTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029