UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dHlvilvD1Er1+8mvXLaqxGvcSoX/VRvpeLiCdsD0pXE=' 
WHERE 
  key_id = '610ebf81b91ea59e7bec1e259106acf1e4e726e956f30ad4187d3ac4d136c980' 
  AND (
    token = 'dHlvilvD1Er1+8mvXLaqxGvcSoX/VRvpeLiCdsD0pXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030