UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k0EB7WjQ1RQKMWS8NfTIT4LwlW+cC/7gUlEOGX/+W2I=' 
WHERE 
  key_id = '4b210dae204834a519abfee5561c0ef913fe7baf82de2fcd01b05ee02d385b1c' 
  AND (
    token = 'k0EB7WjQ1RQKMWS8NfTIT4LwlW+cC/7gUlEOGX/+W2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049